﻿<UserControl x:Class="VmroleAuthor.Views.ResourceExtensionRequirementsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignWidth="900">    
    
    <UserControl.Resources>       
        <Style x:Key="MyButtonStyle" TargetType="Button">
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Margin" Value="4" />
            <Setter Property="Height" Value="28" />
            <Setter Property="BorderThickness" Value="0"></Setter>
        </Style>
    </UserControl.Resources>

    <Grid  VerticalAlignment="Top" ShowGridLines="False">        
        <Grid.RowDefinitions>
            <RowDefinition Height="6" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="30" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="30" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="6"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="6"/>            
        </Grid.ColumnDefinitions>
        <Label Grid.Row="1" Grid.Column="0"   Content="Add OS Virtual Hard Disk Tag"/>
        <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="2">
            <ComboBox x:Name="NewTagToBeAdded" VerticalAlignment="Center" Height="28" MinWidth="600" HorizontalAlignment="Left" IsEditable="True" ItemsSource="{Binding  AvailableTags}" SelectedItem="{Binding NewTagToBeAdded}" Text="{Binding NewTagToBeAdded, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{x:Null}"/>          
            <Button x:Name="ButtonAddNewTag" Style="{StaticResource MyButtonStyle}" HorizontalAlignment="Left" Command="{Binding AddOsVhdTagCommand}"  CommandParameter="{Binding NewTagToBeAdded}">
                <Image Source="../Img/addgreen.png"/>
            </Button>
        </StackPanel>
        <ContentPresenter Grid.Row="2" Grid.Column="2" Content="{Binding ElementName=NewTagToBeAdded, Path=(Validation.Errors).CurrentItem}" />
        <Label Grid.Row="3" Grid.Column="0" >OS Virtual Hard Disk Tags</Label>
        <ListBox Grid.Row="3" Grid.Column="2" x:Name="TagsList"  ItemsSource="{Binding Path=OSVirtualHardDiskRequirements}"  >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Tag}"/>
                        <Button Style="{StaticResource MyButtonStyle}" HorizontalAlignment="Right" Name="btnDelete"  Command="{Binding RemoveOsVhdTagCommand}"  CommandParameter="{Binding Tag}">
                            <Image Source="../Img/deletered.png" />
                        </Button>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>      
        
    </Grid> 
</UserControl>
